﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>委托单 - 添加</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="scripts/boot.js" type="text/javascript"></script>
    

    <style type="text/css">
    html, body
    {        
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     
    <form id="form1" method="post">
        <div style="padding: 10px 0 5px 11px;">
            <table style="table-layout:fixed;">
                <tr>
                    <td style="width:100px;">委托单号：</td>
                    <td style="width:200px;">
                        <input name="regFormNo" class="mini-textbox" required="true" emptyText="请输入委托单号" />
                    </td>
                    <td style="width:100px;">委托日期：</td>
                    <td style="width:150px;">
                        <input name="entrustDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                </tr>
                <tr>
                    <td >委托单位名称/<br>发票单位名称：</td>
                    <td >
                        <input name="nameOfEntrustOrg" class="mini-textbox" required="true" emptyText="请输入单位名称" />
                    </td>
                    <td >单位地址：</td>
                    <td >
                        <input name="addressOfEntrustOrg" class="mini-textbox" required="false" emptyText="请输入单位地址" />
                    </td>
                </tr>
                <tr>
                    <td >联系人：</td>
                    <td >
                        <input name="contactPersonOfEntrustOrg" class="mini-textbox" required="false" emptyText="请输入联系人" />
                    </td>
                    <td >联系电话：</td>
                    <td >
                        <input name="phoneOfEntrustOrg" class="mini-textbox" required="false" emptyText="请输入联系电话" />
                    </td>
                </tr>
                <tr>
                    <td >证书单位名称：</td>
                    <td >
                        <input name="certificationCompany" class="mini-textbox" required="true" emptyText="请输入证书单位名称" />
                    </td>
                    <td >单位地址：</td>
                    <td >
                        <input name="address" class="mini-textbox" required="false" emptyText="请输入单位地址" />
                    </td>
                </tr>
                <tr>
                    <td >联系人：</td>
                    <td >
                        <input name="linkman" class="mini-textbox" required="false" emptyText="请输入联系人" />
                    </td>
                    <td >联系电话：</td>
                    <td >
                        <input name="linkPhone" class="mini-textbox" required="false" emptyText="请输入联系电话" />
                    </td>
                </tr>
                <tr>
                    <td >送检类型：</td>
                    <td >
                        <mini-combobox name="dictCheckType" showNullItem="true" url="/sign/web/dictionary/val/code/checkType" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                    <td >受理日期：</td>
                    <td >
                        <input name="acceptDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                </tr>
                <!--
                <tr>
                    <td >邮编：</td>
                    <td >
                        <input name="zipCode" class="mini-textbox" required="false" emptyText="请输入邮编" />
                    </td>
                    <td ></td>
                    <td >

                    </td>
                </tr>
                -->
            </table>
        </div>
        <div style="text-align:center;padding:10px;">
            <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>       
        </div>        
    </form>
    <script type="text/javascript">
        mini.parse();

        var form = new mini.Form("form1");

        function SaveData() {
            var o = form.getData();            

            form.validate();
            if (form.isValid() == false) return;

            o.entrustDate = mini.formatDate(o.entrustDate,'yyyy-MM-dd');
            o.acceptDate = mini.formatDate(o.acceptDate,'yyyy-MM-dd');
            // var json = mini.encode([o]);
            $.ajax({
                url: "../bus/utensil/indent/save",
		        type: 'post',
                data:JSON.stringify(o),
                dataType:"json",
                contentType: "application/json;charset=UTF-8",
                cache: false,
                success: function (text) {
                    CloseWindow("save");
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                    CloseWindow();
                }
            });
        }

        ////////////////////
        //标准方法接口定义
        function SetData(data) {
            if (data.action == "edit") {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);

                $.ajax({
                    url: "" + data.id,
                    cache: false,
                    success: function (text) {
                        var o = mini.decode(text);
                        form.setData(o);
                        form.setChanged(false);

                        // onDeptChanged();
                        mini.getbyName("position").setValue(o.position);
                    }
                });
            }
        }

        function GetData() {
            var o = form.getData();
            return o;
        }
        function CloseWindow(action) {            
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();            
        }
        function onOk(e) {
            SaveData();
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }
        //////////////////////////////////
        function onDeptChanged(e) {
            var deptCombo = mini.getbyName("dept_id");
            var positionCombo = mini.getbyName("position");
            var dept_id = deptCombo.getValue();

            positionCombo.load("" + dept_id);
            positionCombo.setValue("");
        }



    </script>
</body>
</html>
